package net.zisen.cloud.order.ctrl;

import net.zisen.cloud.base.msg.ResultMsg;
import net.zisen.cloud.order.model.Order;
import net.zisen.cloud.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tim/278002989@qq.com
 * @Classname OrderCtrl
 * @Description TODO
 * @Date 2019-05-17 16:09
 */
@RestController
public class OrderCtrl {

    @Autowired
    private OrderService service;


    @PostMapping("order")
    public ResultMsg<Order> addOrder(@RequestParam Long uid, @RequestParam Long goodsId, @RequestParam Integer quality) throws Exception {
        return this.service.addOrder(uid, goodsId, quality);
    }

    @GetMapping("pay/order")
    public ResultMsg<Order> payOrder(@RequestParam String num) throws Exception {
        return this.service.payOrder(num);
    }

}
